import { Tree, Input } from 'antd';
import React, { Component } from 'react';

const { TreeNode } = Tree;
const { Search } = Input;

class SearchTree extends Component {
  state = {
    expandedKeys: ['0-0', '0-0-0'],
  };

  render() {
    const { expandedKeys } = this.state;

    return (
      <div>
        <Search style={{ marginBottom: 8 }} placeholder="搜索" />
        <Tree style={{ height: 500, overflow: 'auto' }} defaultExpandedKeys={expandedKeys}>
          <TreeNode title="产品分类" key="0-0">
            <TreeNode title="物流" key="0-0-0">
              <TreeNode title="海运" key="0-0-0-1"></TreeNode>
              <TreeNode title="空运" key="0-0-0-2"></TreeNode>
              <TreeNode title="拖车" key="0-0-0-3"></TreeNode>
            </TreeNode>
            <TreeNode title="报关" key="0-3-0"></TreeNode>
            <TreeNode title="保险" key="0-4-0"></TreeNode>
            <TreeNode title="软件" key="0-5-0"></TreeNode>
            <TreeNode title="金融" key="0-6-0"></TreeNode>
          </TreeNode>
        </Tree>
      </div>
    );
  }
}

export default SearchTree;
